package gmu.xytxl.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import gmu.xytxl.bean.Yhxx;
import gmu.xytxl.service.IXymdService;
import gmu.xytxl.service.IYhxxService;
import gmu.xytxl.service.impl.XymdServiceImpl;
import gmu.xytxl.service.impl.YhxxServiceImpl;

/**
 * Servlet implementation class Yhxx
 */
@WebServlet("/FindYhxx")
public class FindYhxx extends HttpServlet {
	private static final long serialVersionUID = 1L;

    /**
     * Default constructor. 
     */
    public FindYhxx() {
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		IYhxxService yhxxService = new YhxxServiceImpl();
		String string = yhxxService.findAllYhxxJson();
		System.out.println(string);
		response.getWriter().write(string);  
		response.getWriter().flush();
		
//	     response.setContentType("text/html;charset=utf-8");          
//	        /* 设置响应头允许ajax跨域访问 */  
//	        response.setHeader("Access-Control-Allow-Origin", "*");  
//	        /* 星号表示所有的异域请求都可以接受， */  
//	        response.setHeader("Access-Control-Allow-Methods", "GET,POST");  
//	       
//	        //获取微信小程序get的参数值并打印
//	        String username = request.getParameter("username");
//	        String password = request.getParameter("password");
//	        System.out.println("username="+username+" ,password="+password);
//	        
//	        //返回值给微信小程序
//	        Writer out = response.getWriter(); 
//	        out.write("进入后台了");
//	        out.flush(); 
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
